home *** CD-ROM | disk | FTP | other *** search
/ Day Cry / Day Cry CD.bin / oh_towns / ein / sources / einlib.lzh / LIBSRC.LZH / EIN_PAL.C < prev    next >
C/C++ Source or Header  |  1994-09-05  |  3KB  |  121 lines

  1. /*<Header>==============================================================
  2. *
  3. *    FILE MANAGER / "EIN_PAL.C"
  4. *
  5. *        [ EIN(tm) project : âpâîâbâgæÇì∞òΓÅòè╓ÉöîQ ]
  6. *
  7. *    COPYRIGHT  Nam  1994, All rights reserved.
  8. *
  9. *-----------------------------------------------------------------------
  10. *    V1.0L01â┐    94.07.06/Nam    âvâìâgâ^âCâv
  11. *    V1.0L01â└    94.08.31/Nam    32KÉFé┼é╠ÉFé╕éΩÅCÉ│
  12. *</Header>==============================================================*/
  13. #include    <stdio.h>
  14. #include    <stdlib.h>
  15. #include    <string.h>
  16. #include    <snd.h>
  17. #include    <winb.h>
  18. #include    <te.h>
  19. #include    <fntb.h>
  20. #include    <gui.h>
  21. #include    <egb.h>
  22. #include    <msdos.cf>
  23. #include    <loader.h>
  24. #include    <math.h>
  25. #include    <io.h>
  26. #include    <guidbg.h>
  27.  
  28. #define    EIN_PAL
  29. #include    "..\eintm.h"
  30.  
  31. #ifndef NOERR
  32. #define    NOERR    (0)
  33. #endif
  34. #ifndef ERROR
  35. #define    ERROR    (1)
  36. #endif
  37.  
  38. /*<Func>================================================================
  39. *    int    EIN_initGuiColor()
  40. *
  41. *    üyèT  ùvüz    GUIâpâîâbâgâeü[âuâïé≡âüâjâàü[ÉFé╔ìçéφé╣éΘ
  42. *
  43. *    üyï@  ö\üz    
  44. *
  45. *    üyôⁿ  ù═üz    é╚é╡
  46. *
  47. *    üyÅo  ù═üz    é╚é╡
  48. *
  49. *    üyè╓ÉöÆlüz    == 0        É│ÅφÅIù╣
  50. *
  51. *    üyÆì  ê╙üz    Åëè·ë╗Ä₧é╔êΩôxé╛é»Ä└ìsé╡é─é¡é╛é│éóüB
  52. *                â^âCâ~âôâOé═'MMI_Init()'é╠îπé┼üAé⌐é┬GUIòöòié≡ò\Īé╖éΘæOé┼é╖üB
  53. *
  54. *    üyÄQ  Å╞üz    
  55. *
  56. *-----------------------------------------------------------------------
  57. *    V11L10    1994.07.06/Nam
  58. *</Func>==============================================================*/
  59. int    EIN_initGuiColor()
  60. {
  61.     static    int        ct32k[16] = {
  62. //        0x00000000, 0x5caf5caf, 0x02200220, 0x02310231,
  63. //        0x63186318, 0x640e640e, 0x63186318, 0x42104210,
  64. //        0x04210421, 0x76377637, 0x03e003e0, 0x03ff03ff,
  65. //        0x7c007c00, 0x7c1f7c1f, 0x07fa07fa, 0x7fff7fff
  66.         0x00000000, 0x3cb73cb7, 0x37293729, 0x67f567f5,
  67.         0x4e734e73, 0x640f640f, 0x67396739, 0x3def3def,
  68.         0x14a514a5, 0x5e3b5e3b, 0x03600360, 0x00150015,
  69.         0x2d6b2d6b, 0x7c1f7c1f, 0x6fe06fe0, 0x7fff7fff
  70.     };
  71.     static    int        ct16m[16] = {
  72.         0x00000000, 0x00b02070, 0x0040c060, 0x00a0f0c0,
  73.         0x00909090, 0x007000c0, 0x00c0c0c0, 0x00707070,
  74.         0x00202020, 0x00e080b0, 0x0000d000, 0x00a00000,
  75.         0x00505050, 0x00f000f0, 0x0000f0d0, 0x00ffffff
  76.     };
  77.  
  78.     typedef struct __PALVAL{
  79.         unsigned int    colorNo;        /* ô╟é▌ĵé┴é╜âüâjâàü[ÉFö╘ìå         */
  80.         char            blue;           /* É┬é╠èKÆ▓(0ü`255)                 */
  81.         char            red;            /* É╘é╠èKÆ▓(0ü`255)                 */
  82.         char            green;          /* ù╬é╠èKÆ▓(0ü`255)                 */
  83.         char            eop;            /* âfü[â^ÅIù╣(0)                    */
  84.     }_PALVAL;
  85.     typedef struct __MENUPAL{
  86.         unsigned int    maxcolor;       /* ô╟é▌ĵé┴é╜âüâjâàü[ÉFé╠æìÉö       */
  87.         _PALVAL         c[16];          /* âpâîâbâgâfü[â^                   */
  88.     }_MENUPAL;
  89.     
  90.     _MENUPAL        pal;
  91.     unsigned int    *tbl;
  92.     register int    i, j, ret;
  93.  
  94.     //    âüâjâàü[ÉFé≡ĵô╛
  95.     pal.maxcolor = 0;
  96.     ret = EGB_getTmenuPalette( &pal ) ;
  97.     #ifdef DEBUG
  98.     printf("EIN_setGuiColor: ret=%d,  palmax=%d\n", ret, pal.maxcolor);
  99.     #endif
  100.     
  101.     // 256ÉFé╠ÅΩìç
  102.     tbl = MG_getColorTable( 1 ) ;    /* 256 */
  103.     for( i = 0 ; i < 16 ; i++ ) {
  104.         tbl[i] = i + (i << 8) + (i<<16) + (i << 24 ) ;
  105.     }
  106.     
  107.     // 32ké╠ÅΩìç
  108.     tbl = MG_getColorTable( 2 ) ;    /* 32k */
  109.     for( i=0; i<16; i++ ){
  110.         tbl[i] = ct32k[i];
  111.     }
  112.     
  113.     // 16Mé╠ÅΩìç
  114.     tbl = MG_getColorTable( 3 ) ;    /* 16M */
  115.     for( i=0; i<16; i++ ){
  116.         tbl[i] = ct16m[i];
  117.     }
  118.     
  119.     return NOERR;
  120. }
  121.